﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace PhotoBook.Services
{

    public class StoreTransformation : PhotoBook.Model.Services.IStore
    {
        #region IStore Members

        public void SaveTransformationToFile(PhotoBook.Model.Entities.FotoTransformation fotoTransformation, string file)
        {
            SaveTransformationToFile(fotoTransformation, System.IO.File.Open(file, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite, System.IO.FileShare.None));            
        }

        public void SaveTransformationToFile(PhotoBook.Model.Entities.FotoTransformation fotoTransformation, FileStream stream)
        {
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter binaryWriter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            binaryWriter.Serialize(stream, fotoTransformation);
            stream.Close();
        }

        #endregion
    }
}


